package com.newcoder.leetcode;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class String_reverseString {

    public static void main(String[] args) {
        char[] s = new char[]{'h','e','l','l','o'};
        new String_reverseString().reverseString(s);
        System.out.println(Arrays.toString(s));
    }

    public void reverseString(char[] s) {
        char[] temp = new char[s.length];
        for (int i = 0; i < s.length; i++) {
            temp[i] = s[i];
        }

        int index = 0;
        for (int i = temp.length-1; i >= 0; i--) {
            s[index] = temp[i];
            index++;
        }
    }
}
